package cn.tedu;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class Demo05 {
    public static void main(String[] args) {
        try (Connection conn = DBUtils.getConn()){
            Statement s = conn.createStatement();
            ResultSet rs = s.executeQuery("SELECT * FROM car");
            while (rs.next()){
                int id = rs.getInt(1);
                String title= rs.getString(2);
                String type = rs.getString(3);
                double price = rs.getDouble(4);
                System.out.println(id+":"+title+":"+type+":"+price);
            }
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }
    }
}
